<?php
$service  = new SoapClient("http://208.74.72.210:8080/EnticeWS/services/billing3?wsdl");

$key = 'pass';
$key = mkResllerKey($key);

//041565409351933
//$data = $service->getSubscriber('12',$key, '04128582369454235');
//acct_id = 283
//cust_id = 4128

//041287165256993
$cust_id = '4156';
$acct_id = '283';

$xml = new SimpleXMLElement('<EnticeRequest></EnticeRequest>');
	$xmldata = $xml->addChild('data');
		$row = $xmldata->addChild('row');
			$row->addChild('ACCT_ID',$acct_id);
			$row->addChild('CUST_ID',$cust_id);
			$row->addChild('FIRST_NAME','tuan' );
			$row->addChild('LAST_NAME','tuan' );
			$row->addChild('LIMIT',6);
			$row->addChild('USER_NAME','tuan');
			$row->addChild('PASSWORD','tuan');
			$row->addChild('STATUS','6');
			$row->addChild('TTL','6');
				$contact = $row->addChild('ANILIST');
					$ani = $contact->addChild('ANI');
						$ani->addChild('NUMBER','01203003698');
						$ani->addChild('PIN','111');
					$ani = $contact->addChild('ANI');
						$ani->addChild('NUMBER','01203003699');
						$ani->addChild('PIN','222');


$data = $service->getANISubscriber('12',$key,'041560981722186');

header('Content-type: text/xml');
echo $data;

//$object = simplexml_load_string($data);

//$object = simplexml_load_string($data);

//var_dump($object);

//$a = $object->data->row->BALANCE;
//var_dump($object); die;
//$x = $object->data->row->children('endpoint');

/*
foreach($object->data->row->endpoint as $e)
{
    var_dump(get_object_vars($e));
}
*/



function mkResllerKey($key)
{
	$dt = gmdate("m/d/Y", time());
	$key =substr($dt,0,6).$key.substr($dt, 5);
	return md5($key);
}